<template>
    <div class="myCartrow3div">
    <el-row class="myCartrow3" type="flex" justify="center">
        <el-col :span="17"></el-col>
        <el-col :span="4" class="myCartcol3" style="margin-right:-30px"><div class="myCartComputedPricediv">
            <div class="myCartCPleftdiv">共1件商品 商品金额</div>
            <div class="myCartCPleftdiv">优惠金额</div>
            <div class="myCartCPleftdiv">总金额（含运费）</div></div></el-col>
        <el-col :span="3" class="myCartcol3" style="margin-right:20px"><div class="myCartComputedPricediv">
            <div class="myCartCPrightdiv">￥{{totalpricecart}}</div>
            <div class="myCartCPrightdiv">-￥{{discountcart}}.00</div>
            <div class="myCartfinallyPrice">￥{{totalrealpricecart}}</div>
        </div></el-col>
    </el-row>
    </div>
</template>

<script>
    export default {
        name:'XiaoCartTotalPrice',
        data(){
            return{
                totalpricecart:0,   //需要全局传到3
                totalrealpricecart:0,
                discountcart:0,
                numchangeprice:[],
            }
        },
        mounted(){
            this.$bus.$on('CPListtoCTPrice',(totalpricecart,totalrealpricecart,discountcart)=>{
                this.totalpricecart=totalpricecart
                this.totalrealpricecart=totalrealpricecart
                this.discountcart=discountcart
            })      //这里可能只会执行一次
        },
        beforeDestroy(){
            this.$bus.$off('CPListtoCTPrice')
        }
    }
</script>

<style scoped>

.myCartrow3div{
    margin-left: 35px;
    margin-right: 35px;
    margin-top: 40px;
    border: 1px solid rgb(172, 172, 172);
}
.myCartrow3{
    height: 100%;
}
.myCartcol3{
    height: 94px;
    font-size: 12px;
    margin-left: 30px;
}
.myCartComputedPricediv{
    text-align: right;
}
.myCartCPleftdiv{
    opacity: 0.6;
    margin-top: 10px;
}
.myCartCPrightdiv{
    font-size: 13px;
    margin-top: 10px;
}
.myCartfinallyPrice{
    margin-top: 6px;
    font-size: 18px;
    color: rgb(228, 67, 102);
}
</style>